#pragma once
#include "object.h"
#include "Array2D.h"
#include "Array3D.h"
#include "coords.h"
#include "message.h"
#include "Keyboard.h"
#include "stdafx.h"
#include "data.h"

#include <fstream>
#include <iostream>
#include <conio.h>


#define ROT_LEFT		1
#define ROT_RIGHT		2
#define ROT_CLKWISE		3
#define ROT_CCLKWISE	4


class CCube :
	public CObject
{
public:
	CCube(void);
	~CCube(void);

	virtual void	parseMessage(Message& msg, vector<Message>& retMsg);

private:
	PCoords			getNewCoords(const PCoords& oldCoords, int rotDirection);
	PArray2D		getSurrCells(const PCoords& pos);
	PArray2D		getCrossSection(const PCoords& pos);
	void			Rotate(int direction);

private:
	PArray2D	crSection;// crSectionBg;
	PArray3D	cube;
	int			xs,ys,zs;	// array size
	int			dir;		// state for rotation of the hero coords
};

/*
class CCubeDrawData :
	public CData
{
public:
	PArray2D sprites;	// Array of integers which are point to sprites
						// When message will be destroyed, instance of 
						// CCubeDrawData will be destroyed too, 
						// but this pointer will survive. It have been delete in CUBE.

	CCoords coord;		// X,Y - coords of centre
						// Z   - layer number. 0 is the nearest
};
*/